/** @jsxImportSource @emotion/react */
import * as React from "react";
import {CCell, Cell, Table, TableBody, TableRow, Text, TableHead,} from "customize-easy-ui-component";
import {RepLink} from "../../common/base";
import {useOmnipotentPref} from "../../hook/useOmnipotentPref";
import {TailMenRowIspCheck} from "../../contain/rarelyVary";
import {item缺陷问题} from "./editDefect";

const tailRender=(orc: any, name: string,lix:number,unit:any)=><>
  <Cell><div css={{whiteSpace: 'pre-wrap'}}>{orc?.[name]?.m??'／'}</div></Cell>
  <Cell><div css={{whiteSpace: 'pre-wrap'}}>{orc?.[name]?.F??'／'}</div></Cell>
  <Cell><div css={{whiteSpace: 'pre-wrap'}}>{orc?.[name]?.r??'／'}</div></Cell>
</>;

export const 缺陷问题处理= ({theme, orc, rep} :{theme: any, orc:any, rep:any}
) => {
  const [renderBrkTest]=useOmnipotentPref({orc, config:item缺陷问题,
             tailRender, pcols:0, noNo:true, unitCel:false});
  return <>
    <div css={{"@media print": {paddingBottom: '3.5rem', pageBreakInside: 'avoid'}} }>
      <Text id='Defecthandle' variant="h2" css={{textAlign: 'center', marginTop: '1rem',
      }}>缺陷和问题的处理或者整改情况</Text>
      <div css={{display: 'flex', justifyContent: 'space-between'}}>
        <Text></Text>
        <Text>报告编号：{rep.isp.no}</Text>
      </div>
    </div>
    <Table fixed={ ["10%","22%","%","24%"] } css={{borderCollapse: 'collapse', "@media print": {marginTop: '-3.5rem'}}} tight  miniw={800}>
      <TableHead>
          <TableRow>
           <CCell colSpan={1}>检验范围</CCell><CCell>检验方法</CCell><CCell>检验发现缺陷和问题的位置、性质、程度</CCell><CCell>问题处理或者整改情况</CCell>
          </TableRow>
      </TableHead>
      <TableBody>
        <RepLink rep={rep} tag={"Defecthandle"}>
          {renderBrkTest}
          <TableRow>
            <Cell colSpan={4}><div css={{minHeight: '2rem',whiteSpace:'pre-wrap'
            }}>备注：<br/>{orc.缺陷备注??'／'}</div></Cell>
          </TableRow>
        </RepLink>
      </TableBody>
    </Table>
    <TailMenRowIspCheck orc={orc} rep={rep} href={`/report/${rep?.modeltype}/ver/${rep?.modelversion}/${rep?.id}/ProjectList#ProjectList`}>
    </TailMenRowIspCheck>
    <Text css={{fontSize:'0.7rem'}}>
    </Text>
  </>;
};
